package com.anxin.act.task.entity;

import com.alibaba.fastjson.JSONArray;
import com.anxin.act.task.vo.TaskVo;
import com.anxin.common.utils.sys.UserUtils;
import com.anxin.sys.system.entity.SysUser;
//import io.swagger.annotations.ApiModel;
//import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.anxin.framework.aspectj.lang.annotation.Excel;
import com.anxin.framework.web.entity.BaseEntity;
import java.util.Date;
import java.util.List;

/**
 * 流程历史任务 对象 view_hi_task
 *
 * @author jbs
 * @date 2021-10-25
 */
//@ApiModel(description = "流程历史任务")
public class ViewHiTask extends BaseEntity<ViewHiTask>{
    private static final long serialVersionUID = 1L;

    /** Activiti 任务ID */
    //@ApiModelProperty(value = "Activiti 任务ID",position=20)
    private String taskId;

    /** 任务名称 */
    //@ApiModelProperty(value = "任务名称",position=30)
    private String taskName;

    /** 流程ID */
    //@ApiModelProperty(value = "流程ID",position=40)
    private String actId;

    /** 审批人登录名 */
    //@ApiModelProperty(value = "审批人登录名",position=50)
    private String assignee;


    /** 审批人ID  */
    //@ApiModelProperty(value = "审批人ID",position=40)
    private String assigneeId;

    /** 审批人ID集合(查询用)  */
    //@ApiModelProperty(value = "审批人ID集合(查询用) ",position=40)
    private String[] assigneeIdList;

    /** 审批人名称  */
    //@ApiModelProperty(value = "审批人名称",position=40)
    private String assigneeName;

    /** 审批人头像  */
    //@ApiModelProperty(value = "审批人头像",position=40)
    private String assigneeAvatar;

    /** 任务类型 */
    //@ApiModelProperty(value = "任务类型",position=60)
    private String type;

    /** 任务来源类型 */
    //@ApiModelProperty(value = "任务来源类型",position=60)
    private String sourceType;

    /** 流程实例名称 */
    //@ApiModelProperty(value = "流程实例名称",position=70)
    private String title;

    /** 申请用户昵称 */
    //@ApiModelProperty(value = "用户登录名",position=70)
    private String applyLoginName;

    /** 用户昵称 */
    //@ApiModelProperty(value = "用户昵称",position=80)
    private String applyNickName;

    /** 开始时间 */
    //@ApiModelProperty(value = "开始时间",position=90)
    private Date startTime;

    /** 审批时间 */
    //@ApiModelProperty(value = "审批时间",position=90)
    private Date approvalTime;

    /** 名称*/
    //@ApiModelProperty(value = "名称 ",position=100)
    private String processName;

    /** 删除原因*/
    //@ApiModelProperty(value = "删除原因 ",position=100)
    private String deleteReason;

    /**
     * 查询类型
     */
    private String queryType;
    /**
     * 流程节点ID
     */
    private String sid;

    /**
     * 是否未读
     */
    private Boolean readStatus;

    /**
     * 审批意见
     */
    private List<WfActHiComment> commentList;

    public ViewHiTask(){

    }

    public ViewHiTask(TaskVo taskVo){
        this.title = taskVo.getTitle();
        this.processName = taskVo.getProcessName();
    }

    public String getSid() {
        return sid;
    }

    public void setSid(String sid) {
        this.sid = sid;
    }

    /**
     * 审批审批人等数据
     */
    public void intiData(){
        SysUser applyUser = UserUtils.findByUserNameContainsDelete(this.applyLoginName);
        if (applyUser != null){
            this.applyNickName = applyUser.getNickName();
        }
        SysUser assigneeUser = UserUtils.findByUserNameContainsDelete(this.assignee);
        if (assigneeUser != null){
            this.assigneeName = assigneeUser.getNickName();
            this.assigneeId = assigneeUser.getId();
        }

    }

    public String getSourceType() {
        return sourceType;
    }

    public void setSourceType(String sourceType) {
        this.sourceType = sourceType;
    }

    public ViewHiTask(String actId){
       this.actId = actId;
    }
    public ViewHiTask(String actId,String sid){
       this.actId = actId;
       this.sid = sid;
    }

    public void setTaskId(String taskId){
        this.taskId = taskId;
    }

    public String getTaskId(){
        return taskId;
    }
    public void setTaskName(String taskName){
        this.taskName = taskName;
    }

    public String getTaskName(){
        return taskName;
    }
    public void setActId(String actId){
        this.actId = actId;
    }

    public String getActId(){
        return actId;
    }
    public void setAssignee(String assignee){
        this.assignee = assignee;
    }

    public String getAssignee(){
        return assignee;
    }
    public void setType(String type){
        this.type = type;
    }

    public String getType(){
        return type;
    }
    public void setTitle(String title){
        this.title = title;
    }

    public String getTitle(){
        return title;
    }
    public void setApplyNickName(String applyNickName){
        this.applyNickName = applyNickName;
    }

    public String getApplyNickName(){
        return applyNickName;
    }
    public void setStartTime(Date startTime){
        this.startTime = startTime;
    }

    public Date getStartTime(){
        return startTime;
    }
    public void setProcessName(String processName){
        this.processName = processName;
    }

    public String getProcessName(){
        return processName;
    }

    public String getAssigneeId() {
        return assigneeId;
    }

    public void setAssigneeId(String assigneeId) {
        this.assigneeId = assigneeId;
    }

    public String getAssigneeName() {
        return assigneeName;
    }

    public void setAssigneeName(String assigneeName) {
        this.assigneeName = assigneeName;
    }

    public String getAssigneeAvatar() {
        return assigneeAvatar;
    }

    public void setAssigneeAvatar(String assigneeAvatar) {
        this.assigneeAvatar = assigneeAvatar;
    }

    public Date getApprovalTime() {
        return approvalTime;
    }

    public void setApprovalTime(Date approvalTime) {
        this.approvalTime = approvalTime;
    }

    public String getQueryType() {
        return queryType;
    }

    public void setQueryType(String queryType) {
        this.queryType = queryType;
    }

    public String getApplyLoginName() {
        return applyLoginName;
    }

    public void setApplyLoginName(String applyLoginName) {
        this.applyLoginName = applyLoginName;
    }

    public String getDeleteReason() {
        return deleteReason;
    }

    public void setDeleteReason(String deleteReason) {
        this.deleteReason = deleteReason;
    }

    public Boolean getReadStatus() {
        return readStatus;
    }

    public void setReadStatus(Boolean readStatus) {
        this.readStatus = readStatus;
    }

    public List<WfActHiComment> getCommentList() {
        return commentList;
    }

    public void setCommentList(List<WfActHiComment> commentList) {
        this.commentList = commentList;
    }

    public String[] getAssigneeIdList() {
        return assigneeIdList;
    }

    public void setAssigneeIdList(String[] assigneeIdList) {
        this.assigneeIdList = assigneeIdList;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("taskId", getTaskId())
            .append("taskName", getTaskName())
            .append("actId", getActId())
            .append("assignee", getAssignee())
            .append("type", getType())
            .append("title", getTitle())
            .append("applyNickName", getApplyNickName())
            .append("startTime", getStartTime())
            .append("processName", getProcessName())
            .toString();
    }
}
